package com.wzqj.agent.common;

import com.alibaba.fastjson.JSONObject;


/**
 * 创建时间：2015-7-27 下午1:17:27
 * @author wh
 * @version 2.2
 * 向前台输出的标准json格式
 */
public class JsonOutput {

	private String errCode = "0", retCode = "0", msg = "";

    private Object data = new JSONObject();

	public JsonOutput setErrCode(String errCode) {
        this.errCode = errCode;
		return this;
	}
	
	public JsonOutput setErrCode(long errCode) {
        this.errCode = errCode+"";
		return this;
	}

	public JsonOutput setRetCode(String retCode) {
        this.retCode = retCode;
		return this;
	}
	
	public JsonOutput setRetCode(long retCode) {
        this.retCode = retCode+"";
		return this;
	}

	public JsonOutput setMsg(String msg) {
        this.msg = msg;
		return this;
	}

	public JsonOutput setData(Object data) {
        this.data = data;
		return this;
	}

    public JSONObject toJSONObject() {

        JSONObject resultValue = new JSONObject();
        resultValue.put("errCode",this.errCode);
        resultValue.put("retCode",this.retCode);
        resultValue.put("msg",this.msg);
        if (this.data == null){
            this.data = "";
        }
        resultValue.put("data",this.data);

        return resultValue;
    }
}
